const _ = require("lodash");

// 计算“正确”与“错误”段的总和（即所有段的长度之和）
function calcTotalLength(frequencyObj) {
  let total = 0;
  _.forEach(frequencyObj, (count, lengthStr) => {
    const length = Number(lengthStr);
    total += length * count;
  });
  return total;
}

module.exports = calcTotalLength;
